const router = require('koa-router')();
const wordhistory = require('../modules/wordhistory');

//获取数据
router.get('/wordhistory',async (ctx,next) => {
    ctx.body = await wordhistory.selectWordhistory();  
})
//增加数据
router.post('/wordhistory',async (ctx,next) => {
    ctx.body = await wordhistory.addWordhistory(ctx.request.body)
})
//删除数据
router.delete('/wordhistory/:id',async (ctx,next) => {
    ctx.body = await wordhistory.deleteWordhistory(ctx.params);
})
//修改数据
router.put('/wordhistory',async (ctx,next) => {
    ctx.body = await wordhistory.putWordhistory(ctx.request.body)
})

module.exports = router;